# Python 2.6.4
# Project Euler, Problem 122
# Copyright 2010 Talha Zaman

path = [[range(1, i+1)] for i in range(201)]
for i in range(1, len(path)):
    for j in path[i]:
        for k in [a for a in j if i+a<len(path)]: 
            if len(path[i][0])+1 < len(path[i+k][0]): path[i+k] = [j + [i+k]]
            elif len(path[i][0])+1 == len(path[i+k][0]) and len(path[i+k])<5: path[i+k].append(j + [i+k])
print sum(len(p[0])-1 for p in path[1:])
